<?php
// +---------------------------------------------------------------------------+
// | This file is part of the KnowledgebasePublisher package                   |
// | KnowledgebasePublisher - web based knowledgebase publisher tool           |
// |                                                                           |
// | Author:  Evgeny Leontev <eleontev@gmail.com>                              |
// | Copyright (c) 2005 Evgeny Leontev                                         |
// |                                                                           |
// | For the full copyright and license information, please view the LICENSE   |
// | file that was distributed with this source code.                          |
// +---------------------------------------------------------------------------+

class KBCommentView_form extends AppView
{
	
	var $tmpl = 'form.html';

	
	function KBCommentView_form() {
		parent::AppView();
		
		$file = AppMsg::getCommonMsgFile('user_msg.ini');
		$this->msg = array_merge($this->msg, AppMsg::parseMsgs($file));
	}
	
	
	function execute(&$obj, &$manager) {
		
		$tpl = &new tplTemplatez($this->template_dir . $this->tmpl);
		$tpl->tplAssign('error_msg', AppMsg::errorBox($obj->errors));
		
		$tpl->tplAssign('title', $obj->title);
		$tpl->tplAssign('username', $obj->username);		
		$tpl->tplAssign('r_email', $obj->r_email);
		
		
		if($obj->get('user_id')) {
			$tpl->tplSetNeeded('/if_registered');
		} else {
			$tpl->tplSetNeeded('/else_registered');
		}
			
		
		$tpl->tplAssign($this->setCommonFormVars($obj));
		$tpl->tplAssign($this->setStatusFormVars($obj->get('active')));
		$tpl->tplAssign($obj->get());
		$tpl->tplAssign($this->msg);
		
		$tpl->tplParse();
		return $tpl->tplPrint(1);
	}
}
?>
